Repository navigation
Conversation
- CartItems: a first-class collection absorbing the find/map/filter/reduce that used to be duplicated three times in Cart, replacing getItemsCopy() - Cart now takes item ids (increaseQuantity, decreaseQuantity, removeItem), so the UI no longer pulls a Product back out of a CartItem just to hand it back to Cart. Added remainingForFreeShipping(), the Money arithmetic that used to live in JSX - dropped CartItem.getProduct() (the source of that Demeter chain) and the dead getPrice(); renamed the rest to id()/name()/image()/quantity() to match the rest of the domain's naming - quantity clamping moved off CartItem onto Quantity (clampBetween, isAtLeast, isAtMost), Money got isAtLeast/isZero so policies stop comparing raw .toAmount() values - Skill's SkillValue and Product's KnowledgeProfile were the same concept with two vocabularies (intermediate vs adventurer) bridged by a ProductCardLogic shim. Unified on one type, deleted the shim - GoldSilverCopperFormatter split into GoldSilverCopperAmount (conversion) and GoldSilverCopperFormatter (presentation), both got the specs they never had - Stats.asObject() dissolved the value object into a plain record the UI had to re-derive labels from (and rendered "ManaBoost: 0" rows). Stats.list() now returns labeled, non-zero entries directly - a product's lore link and video never actually varied by knowledge level, only the data entry did (same two URLs repeated three times per product). Moved ExtraResources onto Product itself - data/products.ts is now a ProductCatalog built from named blueprints instead of a bare array of five-deep positional constructor calls - moved the three WelcomeSurvey storage repositories out of a UI component folder into domain/welcomeSurvey/infrastructure/ - shared test fixtures (productFixtures.ts) replace the ~90 lines of product construction duplicated across Cart.spec.ts and CartItem.spec.ts Cart went from 90 lines to 58, CartItem from 75 to 51: close to the 50-line rule, not exactly on it, and a first-class collection exists now where none did before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014BcGPRc3sgUJYKihGRXh5g
- vitest.config.ts: two projects, unit (node, src/domain/**) and integration (jsdom, src/ui/** and src/app/**), replacing the vite.config.ts that never had a test block - coverage thresholds (v8 provider): 90% on src/domain, 70% on src/ui, enforced in CI - integration tests for the flows that matter: list products, add to cart, change quantity, remove an item, the free-shipping banner and the "Free" badge, the welcome survey's auto-open/save/close cycle - add the ZustandWelcomeSurveyRepository spec it never had, the third storage implementation now has the same coverage as the other two - Playwright, 2 smoke specs against a built vite preview: home to shop, and add to cart through to the checkout modal. Runs as its own CI job with the report uploaded on failure - CONTRIBUTING.md documents TDD (with two real examples from this repo's own history) and the trophy shape Found and fixed along the way, surfaced by writing real tests against real components: - every umami?.track(...) call site threw ReferenceError whenever the global umami script hadn't loaded (blocked, offline, or simply not present, which is exactly what jsdom is). Switched to window.umami?.track(...), and typed it as a Window property instead of a bare ambient global - tsconfig.json (the app build) was type-checking spec files with none of the vitest/ jest-dom types available, and tsconfig.vitest.json was missing globals.d.ts and vite-env.d.ts, so window and import.meta.env typings weren't visible to it either - every real catalog product costs far more than COMMERCE_CONFIG.freeShippingThreshold, so the "add X more to earn free shipping" banner can never appear against real data. Covered with a mocked, deliberately cheap catalog instead of leaving it untested Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014BcGPRc3sgUJYKihGRXh5g
6 tasks done
Owner
Author
Base automatically changed from
refactor/object-calisthenics-domain
to
fix/domain-red-suite-and-dead-repo
September 2, 2026 19:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #7.
Summary
src/domain/**) and integration (jsdom,src/ui/**and
src/app/**), replacing avite.config.tsthat never had a test blocksrc/domain, 70% onsrc/ui, enforced in CIquantity, remove an item, the free-shipping banner, the welcome survey's
auto-open/save/close cycle
ZustandWelcomeSurveyRepositoryspec it never hadvite preview: home to shop, and add tocart through to the checkout modal. Own CI job, report uploaded on failure
CONTRIBUTING.mddocuments TDD, with two real examples from this repo's own history,and the trophy shape
Writing real tests against real components found and fixed two bugs:
umami?.track(...)call threwReferenceErrorwhenever the analytics scripthadn't loaded, which is exactly what a test environment looks like, and also a real
ad-blocker or a slow network. Switched to
window.umami?.track(...)Test plan
pnpm typecheckpnpm checkpnpm test:coverage, 18 files, 102 tests, thresholds passpnpm buildpnpm test:e2e, both specs pass against a real built preview server🤖 Generated with Claude Code
https://claude.ai/code/session_014BcGPRc3sgUJYKihGRXh5g